package cn.lyf.conf;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

public class MyBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {

    @Override
    public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
        if(registry.containsBeanDefinition("aaa")){
            RootBeanDefinition beanDefinition = new RootBeanDefinition(Object.class);
            registry.registerBeanDefinition("beanName", beanDefinition);
        }
    }

}
